﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ThreadUtilHelpV3
{
    public class ThreadToolV3
    {
        static public void UIThread<t>(t control, Action<t> code) where t : Control
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action<t, Action<t>>(UIThread), new object[] { control, code });
                return;
            }
            code(control);
        }
    }
}
